<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="admin/_fragments :: head(~{::title})">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录</title>
    <!--标题栏图标-->
    <link rel="icon" href="../../static/images/Common/favicon.ico" th:href="@{/images/Common/favicon.ico}" type="images/x-ico" />
    <link rel="stylesheet" href="../static/lib/semantic/semantic.min.css"  th:href="@{/lib/semantic/semantic.min.css}">
    <link rel="stylesheet" href="../../static/css/me-common.css" th:href="@{/css/me-common.css}">
    <link rel="stylesheet" href="../../static/css/me-special.css" th:href="@{/css/me-special.css}">
    <link rel="stylesheet" href="../../static/css/me-media.css" th:href="@{/css/me-media.css}">
    <link rel="stylesheet" href="../static/css/cover-semantic.css" th:href="@{/css/cover-semantic.css}">
</head>
<body>


<div class="m-container-mini m-padded-tb-massive" >
    <div class="ui container">

        <div class="ui middle aligned center aligned grid">
            <div class="column">
                <h2 class="ui teal image header">
                    <img src="../../static/images/Common/favicon.png" th:src="@{/images/Common/favicon.png}"
                         class="image m-padded-tiny">
                    <div class="content">
                        Log-in to your account
                    </div>
                </h2>
                <form class="ui large form" method="post" action="#" th:action="@{/admin/login}">
                    <div class="ui segment">
                        <div class="field">
                            <div class="ui left icon input">
                                <i class="user icon"></i>
                                <input type="text" name="username" placeholder="用户名">
                            </div>
                        </div>
                        <div class="field">
                            <div class="ui left icon input">
                                <i class="lock icon"></i>
                                <input type="password" name="password" placeholder="密码">
                            </div>
                        </div>
                        <div class="field">
                            <div class="ui left input">
                                <input type="text" name="verifyCodeActual"  placeholder="验证码">&nbsp;&nbsp;&nbsp;&nbsp;
                                <img id="captcha_img" alt="点击更换" title="点击更换"
                                     onclick="refresh()" src="/kaptcha" />
                            </div>
                        </div>
                        <button class="ui fluid large teal submit button">登  录</button>
                    </div>

                    <div class="ui error mini message"></div>
                    <div class="ui mini negative message" th:unless="${#strings.isEmpty(message)}"
                         th:text="${message}">用户名和密码错误</div>
                </form>

            </div>
        </div>
    </div>
</div>




<!--/*/<th:block th:replace="admin/_fragments :: script">/*/-->
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script>
<script src="../static/lib/semantic/semantic.min.js"  th:src="@{/lib/semantic/semantic.min.js}"></script>
<!--/*/</th:block>/*/-->


<script>
    $('.ui.form').form({
        fields:{
            username:{
                identifier:'username',
                rules: [{
                    type: 'empty',
                    prompt: '标题：请输入用户名'
                }]
            },
            password:{
                identifier:'password',
                rules: [{
                    type: 'empty',
                    prompt: '密码：请输入密码'
                }]
            }
        }
    })

    //刷新验证码
    function refresh() {
        document.getElementById('captcha_img').src = "/kaptcha?" + Math.random();
    }
</script>

</body>
</html>